import './assets/styles/main.css'
import 'animate.css'
import { createApp, defineComponent, h, renderSlot } from 'vue'
import { createPinia } from 'pinia'
import App from './App.vue'
import router from './router'
import directive from './directives'
import { updateHtmlFontSize } from './breakpoints'
import DatePicker from '@/components/DatePicker.vue'
import './assets/fonts/GB2312.css'
import { type GlobalThemeOverrides, NConfigProvider } from 'naive-ui'
import print from 'vue3-print-nb' // 打印插件


window.flags = {}
updateHtmlFontSize()

const app = createApp(App)
app.component('DatePicker', DatePicker)

app.component(
  'DetailFormProvider',
  defineComponent({
    props: { disabled: { type: Boolean, default: false } },
    setup(props, { slots }) {
      const theme: GlobalThemeOverrides = {
        common: {
          textColorDisabled: '#333333'
        },
        Tag: {
          opacityDisabled: 1
        }
      }

      return () =>
        h(
          NConfigProvider,
          {
            abstract: true,
            themeOverrides: props.disabled ? null : theme
          },
          {
            default: () => renderSlot(slots, 'default')
          }
        )
    }
  })
)
app.use(createPinia()).use(router).use(print).mount('#app')
directive(app)
